package com.coffeeloversupportlibrary.core.base.livadata;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;

/**
 * @author puyv
 * @createTime 2021/11/5 15:38
 * @projectName CoffeeLoverSupportLibrary
 * @className NormalLiveData.java
 * @description TODO
 */
public class NormalLiveData extends MutableLiveData<String> {
    public void observe(LifecycleOwner owner, final CustomObserver observer) {
        super.observe(owner, new Observer<String>() {
            @Override
            public void onChanged(String str) {
                if (str == null) {
                    return;
                }
                observer.onNewMessage(str);
            }
        });
    }

    public interface CustomObserver {
        void onNewMessage(String str);
    }
}
